# $Id$
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

pkgname=foomatic-db-engine
arch=('i686' 'x86_64')
pkgver=4.0.12
pkgrel=6
epoch=4
url="http://www.linuxprinting.org/foomatic.html"
pkgdesc="Foomatic - Foomatic's database engine generates PPD files from the data in Foomatic's XML database. It also contains scripts to directly generate print queues and handle jobs."
license=('GPL2')
depends=('perl' 'libxml2' "cups-filters>=1.0.42" 'bash' 'perl-xml-libxml' 'perl-clone' 'perl-dbi')
makedepends=('cups' 'ghostscript' 'a2ps' 'wget' 'perl-xml-libxml' 'foomatic-db') # 'enscript' 'net-snmp'
optdepends=('foomatic-db:	linuxprinting.org xml files database to create ppd driver files')
backup=('etc/foomatic/defaultspooler')
source=(https://www.openprinting.org/download/foomatic/$pkgname-$pkgver.tar.gz)
md5sums=('b8049e61a3dad76044e83dde0087e0a0')

build() {
  export LIB_CUPS="/usr/lib/cups"
  cd $pkgname-$pkgver
  PERL_INSTALLDIRS=vendor \
  ./configure --prefix=/usr \
    --sbindir=/usr/bin
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR=${pkgdir} install

  # preset default spooler
  echo cups > ${pkgdir}/etc/foomatic/defaultspooler
  # add some docs
  install -Dm644 USAGE ${pkgdir}/usr/share/doc/${pkgname}/USAGE
  install -Dm644 README ${pkgdir}/usr/share/doc/${pkgname}/README

  # cleanup
  rm -r ${pkgdir}/usr/lib/perl5
}
